//
//  ForfotFormViewController.swift
//  iModern
//
//  Created by 立雄 王 on 15/9/1.
//  Copyright (c) 2015年 com.starlooking. All rights reserved.
//

import UIKit
import XLForm

class ForfotFormViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.navigationItem.title = "忘记密码"
        
        initializeForm()
        initBackButton()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    func initializeForm()
    {
        var form:    XLFormDescriptor
        var section: XLFormSectionDescriptor
        var row:     XLFormRowDescriptor
        
        form = XLFormDescriptor(title: " ")
        
        section = XLFormSectionDescriptor.formSectionWithTitle("")
        section.footerTitle = ""
        form.addFormSection(section)
        
        row = XLFormRowDescriptor(tag: "address", rowType: XLFormRowDescriptorTypeText, title: "")
        row.cellConfigAtConfigure["textField.placeholder"] = "请填写您绑定的手机号码"
        row.cellConfig["textLabel.font"] = UIFont.systemFontOfSize(12)
        section.addFormRow(row)
        
        row = XLFormRowDescriptor(tag: "iModern", rowType: XLFormRowDescriptorTypeButton, title: "联系iModern爱魔登客服:4000060155")
        row.cellConfig["textLabel.color"] = UIColor.grayColor()
        row.cellConfig["textLabel.font"] = UIFont.systemFontOfSize(12)
        row.action.formSelector = "didTouchButton:"
        section.addFormRow(row)
        
        section = XLFormSectionDescriptor.formSectionWithTitle("")
        form.addFormSection(section)
        section = XLFormSectionDescriptor.formSectionWithTitle("")
        form.addFormSection(section)
        
        row = XLFormRowDescriptor(tag: "next", rowType: XLFormRowDescriptorTypeButton, title: "找回密码")
         row.cellConfigAtConfigure["backgroundColor"] = UIColor(red: 0.40784313725490196, green: 0.6588235294117647, blue: 0.19215686274509805, alpha: 1)
        row.cellConfig["textLabel.color"] = UIColor.whiteColor()
        row.action.formSelector = "submit:"
        row.required = true
        section.addFormRow(row)
        
        self.form = form
    }

    func submit(sender: XLFormRowDescriptor)
    {
        print("zhaohuimima")
        self.deselectFormRow(sender)
    }
    
    func didTouchButton(sender: XLFormRowDescriptor)
    {
        let phone                = "tel://4000060155"
        UIApplication.sharedApplication().openURL(NSURL(string: phone)!)
        self.deselectFormRow(sender)
    }
    
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
